home *** CD-ROM | disk | FTP | other *** search
- #
- # cachebuild.awk
- # Awk script for cachebuild, already designed to parse:
- # nslookup output from pure BIND 4.8.3,
- # nslookup that comes with SunOS 4.1.3.
- #
-
- # Process NS RRs. These give the names of the root domain servers.
-
- $2=="nameserver" && $3=="=" {
- roothost[$4] = 1;
- }
-
- # Process A RRs. These map domain server names to addresses.
- # Accumulate these into a space-delimited string; we will break them apart later.
- # Note that there may be more than one A RR per root server.
-
- ($2=="inet" || $2=="internet") && $3=="address" && $4=="=" {
- if (roothost[$1] == 1)
- hostaddr[$1] = hostaddr[$1] " " $5;
- }
-
- # Now that we parsed all the records, let's print the rest of the root cache.
- # We break the multiple address strings apart with the "split" function.
-
- END {
- print ";"
- print "; Initial cache data for root domain servers."
- print ";"
- print ""
- printf (".");
- for (i in roothost) {
- print " 99999999 IN NS " i ".";
- }
- print ""
- print ";"
- print "; Prep the cache (hotwire the addresses). Order does not matter."
- print ";"
- print ""
- for (i in hostaddr) {
- ips = hostaddr[i];
- n = split (ips, hstuff, " ");
- for (j=1; j<=n; j++) {
- printf ("%s.", i);
- l = length (i ".");
- if (l < 8) printf (" ");
- if (l < 16) printf (" ");
- if (l < 24) printf (" ");
- print "99999999 IN A " hstuff[j];
- }
- }
- }
-